/**
  ******************************************************************************
  * @file    String.h 
  * @author  Thongnh
  * @version V1.0
  * @date    23/10/2012
  ******************************************************************************
**/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STRLIB_H__
#define __STRLIB_H__

/* Includes ------------------------------------------------------------------*/
#include "BasicTypes.h"

class cStrLib
{
public:
    static void DelayUs(U16 us);
    static void DelayMs(U16 ms);
    static void Strcpy(U8* dst, const U8* src, const U16 len);
    static bool Strcmp(const U8* iData1, const U8* iData2, const U16 len);
    static bool StrCmpWithConst(const U8* iData1, const U8 iConst, const U16 len);

    static U8   HexToAscii(U8 iHex);
    static U8   AsciiToHex(U8 iAscii);
    static U8   HexToDec(U8 iHex);
    static U8   DecToHex(U8 iDec);

    static U16  StrToWord( U8* pStr );
    static void WordToDecStr( U8* pStr, U16 iVal );
    static void ByteToHexStr( U8* pStr, U8 iHex );
    static void StrToStrDec(U8 *pDec, U8 *pStr, U8 iLen);
    static U8   StrDecToByte(U8 *pStr);
    static void ByteToStrDec(U8 *pStr, U8 iByte);

    static U16  StrDecToWord(U8 *pStr);

    static void StrDecToStr(U8 *pStr, U8 *pDec, U8 iLen);
    static void StrToStrHex(U8 *pHex, U8 *pStr, U8 iLen);
    static void StrHexToStr(U8 *pStr, U8 *pHex, U8 iLen);

    static U8   GetHigh16(U16 iVal);
    static U8   GetLow16(U16 iVal);
};

#endif /* __STRLIB_H__ */

